import request from '@/utils/request'

const BASE_URL = '/admin/system/category'

export default {
  findAll() {
    return request({
      url: `${BASE_URL}/findAll`,
      method: 'get'
    })
  },
  getCateById(id) {
    return request({
      url: `${BASE_URL}/findCategoryById/${id}`,
      method: 'get'
    })
  },
  getCatePageInfo(page, limit, searchObj) {
    return request({
      url: `${BASE_URL}/${page}/${limit}`,
      method: 'get',
      params: searchObj
    })
  },
  addCate(data) {
    return request({
      url: `${BASE_URL}/addCategory`,
      method: 'post',
      data
    })
  },
  updateCate(data) {
    return request({
      url: `${BASE_URL}/updateCategory`,
      method: 'post',
      data
    })
  },
  removeCateById(id) {
    return request({
      url: `${BASE_URL}/removeCategoryById/${id}`,
      method: 'get'
    })
  },
  // 批量删除
  removeCateByIds(ids) {
    return request({
      url: `${BASE_URL}/removeCategoryByIds`,
      method: 'delete',
      data: ids
    })
  }
}
